package springbootpackage;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import bean.YamlBean;

@RestController
@RequestMapping("/yaml")
@EnableConfigurationProperties(value = YamlBean.class)
public class ExampleYamlController {

	@Autowired
	private YamlBean yamlBean;
	
	@Value("${com.yml.name}")
	private String name;

	@Value("${com.yml.password}")
	private String password;
	
	@Value("${com.yml.nickname}")
	private String nickname;
	
	@Value("${com.yml.value}")
	private String value;
	
	@Value("${com.yml.number}")
	private int number;
	
	@Value("${com.yml.bignumber}")
	private long bignumber;

	@RequestMapping("/content")
	public String getContent() {
		//sola---123456---亢小辉---49f35b971c203ecb71a3ec1e1366732f---479173669----3854088114362154691
		return name + "---" + password + "---" + nickname + "---" + value + "---" + number + "---" + bignumber;
	}
	
	@RequestMapping("/obj")
	public String getContentByObject() {
		return yamlBean.toString();
	}
}
